import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mall_app/pages/static/SplashPage.dart';
//报错页面
import 'package:mall_app/pages/static/screens/404_error.dart';
import 'package:mall_app/pages/static/screens/404_error_2.dart';
import 'package:mall_app/pages/static/screens/artical_not_found.dart';
import 'package:mall_app/pages/static/screens/broken_link.dart';
import 'package:mall_app/pages/static/screens/camera_access.dart';
import 'package:mall_app/pages/static/screens/connection_faild.dart';
import 'package:mall_app/pages/static/screens/connection_lost.dart';
import 'package:mall_app/pages/static/screens/error.dart';
import 'package:mall_app/pages/static/screens/error_black.dart';
import 'package:mall_app/pages/static/screens/file_not_found.dart';
import 'package:mall_app/pages/static/screens/location_access.dart';
import 'package:mall_app/pages/static/screens/location_errors.dart';
import 'package:mall_app/pages/static/screens/no_connection.dart';
import 'package:mall_app/pages/static/screens/no_file.dart';
import 'package:mall_app/pages/static/screens/no_result_found.dart';
import 'package:mall_app/pages/static/screens/no_space.dart';
import 'package:mall_app/pages/static/screens/payment_faild.dart';
import 'package:mall_app/pages/static/screens/router_offline.dart';
import 'package:mall_app/pages/static/screens/something_went_wrong.dart';
import 'package:mall_app/pages/static/screens/something_wrong.dart';
import 'package:mall_app/pages/static/screens/time_error.dart';

//普通页面
import 'package:mall_app/pages/Home_Page.dart';

final routes = {

  //todo  页面跳转
  '/': (context) => Splash_Page(),
  '/home': (context) => Home_page(),



  //报错引导页面
  '/404': (context) => Error404Screen(),
  '/404_VB': (context) => Error404Screen2(),
  '/ArticleNotFoundScreen': (context) => ArticleNotFoundScreen(),
  '/BrokenLinkScreen': (context) => BrokenLinkScreen(),
  '/CameraAccessScreen': (context) => CameraAccessScreen(),
  '/ConnectionFaildScreen': (context) => ConnectionFaildScreen(),
  '/ConnectionLostScreen': (context) => ConnectionLostScreen(),
  '/ErrorScreen': (context) => ErrorScreen(),
  '/Error2Screen': (context) => Error2Screen(),
  '/FileNotFoundScreen': (context) => FileNotFoundScreen(),
  '/LocationAccessScreen': (context) => LocationAccessScreen(),
  '/LocationErrorScreen': (context) => LocationErrorScreen(),
  '/NoConnectionScreen': (context) => NoConnectionScreen(),
  '/NoFileScreen': (context) => NoFileScreen(),
  '/NoResultFoundScreen': (context) => NoResultFoundScreen(),
  '/NoSpaceScreen': (context) => NoSpaceScreen(),
  '/PaymentFaildScreen': (context) => PaymentFaildScreen(),
  '/RouterOfflineScreen': (context) => RouterOfflineScreen(),
  '/SomethingWentWrongScreen': (context) => SomethingWentWrongScreen(),
  '/SomethingWrongScreen': (context) => SomethingWrongScreen(),
  '/TimeErrorScreen': (context) => TimeErrorScreen(),




  //需要带参数跳转
  // '/searches': (context, {arguments}) => (arguments: arguments),


};

// ignore: missing_return, top_level_function_literal_block
var onGenerateRoute = (RouteSettings settings) {
//统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
